package me.jollyfly.jshop.item.client.api

import me.jollyfly.jshop.common.bean.PageResultBean
import me.jollyfly.jshop.common.bean.ResultBean
import me.jollyfly.jshop.item.client.model.ItemCategoryDO
import me.jollyfly.jshop.item.client.model.ItemDO
import me.jollyfly.jshop.item.client.model.bo.RecommendationBO
import org.springframework.web.bind.annotation.GetMapping
import org.springframework.web.bind.annotation.PathVariable
import org.springframework.web.bind.annotation.PostMapping
import org.springframework.web.bind.annotation.RequestParam


interface ItemApi {

    /**
     * 根据商品ID返回商品信息

     * @param itemId 商品ID
     * *
     * *
     * @return ResultBean封装返回实体类 @see ResultBean
     * *
     * *
     * @author jollyfly
     */
    @GetMapping("/service/item/{id}")
    fun getItemById(@PathVariable("id") itemId: Long?): ResultBean<ItemDO>

    /**
     * 根据父类目Id获取非文件夹子类目

     * @param parnetId 父类目ID
     * *
     * *
     * @return ResultBean
     * *
     * *
     * @author jollyfly
     */

    @GetMapping("/service/item/category/parent/{id}")
    fun listCategoryByParent(@PathVariable("id") parnetId: Long?): ResultBean<List<ItemCategoryDO>>

    /**
     * 根据类目Id分页获取该类目下所有商品

     * @param cid 父类目ID
     * *
     * *
     * @return ResultBean
     * *
     * *
     * @author jollyfly
     */

    @GetMapping("/service/item/list")
    fun listItemByCategory(@RequestParam("cid")cid: Long?, @RequestParam("currentNum")currentNum: Int,
                           @RequestParam("pageSize")pageSize: Int): PageResultBean<List<ItemDO>>

    /**
     * 根据类目Id获取该类目下所有推荐商品

     * @param cid 父类目ID
     * *
     * *
     * @return ResultBean
     * *
     * *
     * @author jollyfly
     */

    @GetMapping("/service/item/recommendation/list/{categoryId}")
    fun listRecommendationByCat(@PathVariable("categoryId") cid: Long?): ResultBean<List<ItemDO>>



    /**
     * 获取所有推荐商品

     * @return ResultBean
     * *
     * *
     * @author jollyfly
     */

    @GetMapping("/service/item/recommendation/list")
    fun listRecommendation(): ResultBean<List<RecommendationBO>>


    @GetMapping("/service/item/category/list")
    fun listCategory(): ResultBean<List<ItemCategoryDO>>


    @GetMapping("/service/item/category/cat_selector")
    fun listCatSelector(): ResultBean<List<ItemCategoryDO>>

    @PostMapping("/service/item/add")
    fun addItem(itemDO: ItemDO): ResultBean<Boolean>

}